export class Dep {
  static target = null

  constructor () {
    this.subs = []
  }

  add (cb) {
    this.subs.push(cb)
  }

  notify () {
    this.subs.forEach((cb) => cb())
  }
}

export function watch (exp, cb) {
  Dep.target = cb
  exp()
  return Dep.target = null
}
